package com.credithc.customers.base.ro;

import com.credithc.customers.base.codes.CustomerCodes;
import com.credithc.customers.base.exception.CustomerException;
import com.credithc.customers.base.utils.CustomerUtils;
import lombok.Data;

/**
 * @author zhukai
 * @date 2018/12/3 14:12
 */
@Data
public class CustomerInfoAddRo extends CustomerBaseRo {

    private String customerNo;

    private Integer type;

    private CustomerIdInfoRo idInfo;

    private ContactRo contact;

    public static void checkBaseParam(CustomerInfoAddRo ro) {
        CustomerUtils.checkRequestNo(ro.getRequestNo());
        CustomerUtils.checkCustomerNo(ro.getCustomerNo());
        Integer type = ro.getType();
        if(type == null){
            throw new CustomerException(CustomerCodes.PARAM_VALIDATE_ERROR, "参数'type'不能为空");
        }else{
            if(type < 1 || type > 3){
                throw new CustomerException(CustomerCodes.PARAM_VALIDATE_ERROR, "type只能是1-3");
            }
        }
    }

}
